package com.gzy.wbapplication.net;

import com.gzy.wbapplication.model.Result;
import com.gzy.wbapplication.model.User;
import com.gzy.wbapplication.model.para.LoginPara;
import com.gzy.wbapplication.net.core.XXModelCallback;
import com.gzy.wbapplication.net.core.XXURLUtils;

import java.util.HashMap;
import java.util.Map;

import okhttp3.Callback;

public class AuthApi {
    public static void doLogin(String username, String password, XXModelCallback<Result<String>> callback) {

        LoginPara loginPara = new LoginPara();
        loginPara.setUsername(username);
        loginPara.setPassword(password);

        XXURLUtils.shared.post(URLs.Auth.login, loginPara, callback);
    }
    public static void getUserinfo(String token, XXModelCallback<Result<User>> callback) {

        Map<String, String> header = new HashMap<>();

        header.put("token",token);

        Map<String, String> para = new HashMap<>();

        XXURLUtils.shared.get(URLs.Auth.userinfo, header, para, callback);
    }


    public static void signup(String username, String password, XXModelCallback<Result<String>> callback) {

        LoginPara loginPara = new LoginPara();
        loginPara.setUsername(username);
        loginPara.setPassword(password);

        XXURLUtils.shared.post(URLs.Auth.signup, loginPara, callback);
    }
}
